/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package data;

import interfaces.GameState;

import tools.StateReader;

/**
 *
 * @author Bruno
 * 
 * In this tree you just can add states and 
 * verify if a given state is already in the tree
 * 
 */
public class StateTree {
    private StateNode   root1, root2;
    private int         stateSize;
    
    public StateTree(int stateSize) {
        this.stateSize = stateSize;
        
        root1 = new StateNode(0);
        root2 = new StateNode(1);
    }
    
    public int addState(GameState gs) {
        StateReader sr      = new StateReader(gs);
        StateNode   node    = sr.isLineSet(0) == 0 ? root1 : root2;
        
        for(int i = 1; i < sr.getNumberOfLines(); ++i) {
            int aux = sr.isLineSet(i);
            
            if(aux == 0) {
                node = node.left;
            } else {
                node = node.right;
            }
        }
        
        return 0;
    }
    
    public boolean contains(GameState gs) {
        return false;
    }
}
